/*
 *      Copyright 2008 Battams, Derek
 *       
 *       Licensed under the Apache License, Version 2.0 (the "License");
 *       you may not use this file except in compliance with the License.
 *       You may obtain a copy of the License at
 *
 *          http://www.apache.org/licenses/LICENSE-2.0
 *
 *       Unless required by applicable law or agreed to in writing, software
 *       distributed under the License is distributed on an "AS IS" BASIS,
 *       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *       See the License for the specific language governing permissions and
 *       limitations under the License.
 */
package com.google.code.gwtsrwc.client;

import com.google.gwt.user.client.ui.Label;

/**
 * A simple label widget that displays the current version of gwt15widgets being used; also provides a static method for accessing the version information
 * @author $Author: derek@battams.ca $
 * @version $Id: VersionLabel.java 21 2008-09-08 14:36:36Z derek@battams.ca $
 * $URL: http://gwtsrwc.googlecode.com/svn/trunk/src/com/google/code/gwtsrwc/client/VersionLabel.java $
 */
public final class VersionLabel extends Label {
	static private String DIR = "@@BLD_DIR@@";
	static private String BUILD = "@@BLD_NUM@@";
	
	/**
	 * Returns the current version information of gwt15widgets as a String
	 * @return The current version number of the library
	 */
	static final public String getVersion() {
		if(BUILD.contains("BLD_NUM") || BUILD.length() == 0)
			BUILD = WidgetStrings.constants.unknownVersion();
		if(DIR.contains("BLD_DIR") || DIR.length() == 0)
			DIR = WidgetStrings.constants.unknownVersion();
		return DIR +  "." + BUILD;
	}

	/**
	 * Constructor
	 */
	public VersionLabel() {
		super.setText(getVersion());
	}
	
	@Override
	final public void setText(String txt) {
		return;
	}
}
